﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Net;
using System.Net.Sockets;

using Giri;

namespace Giri.L1
{
    class Framework
    {
        int listenPort;
        TcpListener listener;

        public Framework(int port)
        {
            listenPort = port;
            listener = new TcpListener(listenPort);
            listener.AllowNatTraversal(true);
            listener.Start();
        }

        ~Framework()
        {
            listener.Stop();
        }

        public Client Accept()
        {
            if(listener.Pending())
                return new Client(listener.AcceptTcpClient());
            return null;
        }
    }
}
